<?php
if(!Auth::check()){
 ?>
   <div class="panel panel-default">
  <div class="panel-heading">Đăng Nhập</div>
  <div class="panel-body">
     <form action="" method="POST" class=" " id="form-login" role="form">
        <input type="text" name="ipt-username" id="ipt-username" class="form-control"  required="required"   placeholder='Mã Số Cán Bộ'>
        <br/>
        <input type="text" name="ipt-pw" id="ipt-pw" class="form-control" required="required"   placeholder='Mật Khẩu'>
        <br/>
        <button type="submit" class="btn btn-primary">Đăng Nhập</button>
        <button type="reset" class="btn btn-default">Nhập Lại</button>
     </form>
  </div>
</div>
<?php
}
?>
<script type="text/javascript">
    $("#form-login").submit(function(event) {
      /* Act on the event */
      $.ajax({
        url: '<?php echo asset("user/login");?>',
        type: 'post',
        dataType: 'json',
        data: {username: $('#ipt-username').val(),
                password: $('#ipt-pw').val()
      },
      })
      .done(function(data) {
        console.log(data);
      })
      .fail(function() {
        console.log("error");
      })
      .always(function() {
        console.log("complete");
      });
      return false;
    });
</script>